<%@page import="com.shsh.safemanage.util.RequestUtil"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.BrowseProblemAction"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>

<%
{
int pageNum = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_PAGE_NUM, 1);
BrowseProblemAction browseAction = ActionCreator.createBrowseProblemAction();
List<Problem> problemList = browseAction.browsePostchecks(request);
int totalNum = (Integer) request.getAttribute(Constants.DAO_RESULT_NUMBER);
Integer totalPage = 0;
if (totalNum % Constants.PAGE_SIZE == 0) {
	totalPage = totalNum / Constants.PAGE_SIZE;
} else {
	totalPage = totalNum / Constants.PAGE_SIZE + 1;
}
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;table-layout: fixed;">
	<tr>
		<td width="10%" class="appbg">&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/trace.gif"  style="vertical-align:middle;"/>查询结果</td>
		<td width="5%"  class="appbg">&nbsp;</td>
		<td width="10%" class="appbg">&nbsp;</td>
		<td width="10%" class="appbg">&nbsp;</td>
		<td width="15%" class="appbg">&nbsp;</td>
		<td width="15%" class="appbg">&nbsp;</td>
		<td width="3%" class="appbg">&nbsp;</td>
		<td width="7%" class="appbg">&nbsp;</td>
		<td width="7%" class="appbg">&nbsp;</td>
		<td width="7%" class="appbg">&nbsp;</td>
		<td width="5%" class="appbg">&nbsp;</td>
		<td class="appbg">&nbsp;</td>
	</tr>
	<tr>		
		<td colspan="11" height="40" style="padding-left:10px;">
			查询到<font color="#FF0000"><%=totalNum%></font>条记录，共<font color="#FF0000"><%=totalPage%></font>页。
			<span style="margin-left: 15px; color: red">
			<%
			if (pageNum > 1) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=pageNum-1%>)">【上一页】</a>
			<%
			}
			%>
			第<%=pageNum%>页
			<%
			if (problemList.size() >= Constants.PAGE_SIZE) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=pageNum+1%>)">【下一页】</a>
			<%
			}
			%>
			</span>
		</td>
	</tr>
	<tr>
		<td class="a_text2" align="center" height="30">检查单位</td>
		<td class="a_text2" align="center">检查人</td>
		<td class="a_text2" align="center" height="30">被查单位</td>
		<td class="a_text2" align="center">装置</td>
		<td class="a_text2" align="center">检查内容记录</td>
		<td class="a_text2" align="center">考核意见与整改意见</td>
		<td class="a_text2" align="center">扣分值</td>
		<td class="a_text2" align="center">要求整改日期</td>
		<td class="a_text2" align="center">整改完成日期</td>
		<td class="a_text2" align="center">填报时间</td>
		<td class="a_text2" align="center">确认人</td>
		<td class="a_text2" align="center">查看</td>
	</tr>
	<%
	int row = 0;
	for (Problem problem : problemList) {
		row++;
	%>
	<tr>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getWriterDepartment1Name()==null?"&nbsp;":problem.getWriterDepartment1Name()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getWriteUserName()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getDepartment1Name()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getEquipmentName()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getProblemContent()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getProblemZhenggai()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getGrade()==null?"0":Util.formatGrade(problem.getGrade())%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getCompleteDate() == null? "&nbsp;":Util.formatDate(problem.getCompleteDate().getTime())%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=(problem.getCloseTime() == null)? "&nbsp;" : Util.formatDate(problem.getCloseTime().getTime())%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=Util.formatDateTime(problem.getWriteTime().getTime())%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%=problem.getCloseUserName()==null?"&nbsp;":problem.getCloseUserName()%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<a href="javascript:" onclick="openProblemDetail(<%=problem.getId()%>)"
			style="color: <%=(problem.getProcessStatus() == Constants.PROBLEM_STATUS_CLOSE)? "black":"red"%>">详细内容</a></td>
	</tr>
	<%
	}
	%>
	<tr>		
		<td colspan="11" height="40" style="padding-left:10px;">
			查询到<font color="#FF0000"><%=totalNum%></font>条记录，共<font color="#FF0000"><%=totalPage%></font>页。
			<span style="margin-left: 15px; color: red">
			<%
			if (pageNum > 1) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=pageNum-1%>)">【上一页】</a>
			<%
			}
			%>
			第<%=pageNum%>页
			<%
			if (problemList.size() >= Constants.PAGE_SIZE) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=pageNum+1%>)">【下一页】</a>
			<%
			}
			%>
			</span>
		</td>
	</tr>
</table>
<%
}
%>